/*
 *  $Id: AngelicProtection.cs 1051 2010-05-18 22:10:41Z thenn.erannor $
 *	This file is a part of Ragima CCG.
 *	(C) 2008 Ragima development group.
 *
 *	Licensed under the terms of the GNU GPL License version 2.
 *
 */

namespace Ragima.Cards001.Light.Abilities {
    public class AngelicProtection: AbilityCard {
        public AngelicProtection(): base("001_l_a_angelic_protection") {
            Level = CompleteLevel.ReadyForTest;
            Element = ElementType.Light;
            AddManaCost(ElementType.Light, 3);
            AddCondition(new AffectCondition<AngelicProtectionAffect>(GetConditionPhrase(), false));
        }

        public override void DoAction(TargetArgs args) {
            Creature angel = args.Caster as Creature;
            if (angel == null) return;
            angel.AddAffect(new AngelicProtectionAffect(angel));
        }

        private class AngelicProtectionAffect: SpellAffect<AngelicProtection> {
            private Creature _angel;

            public AngelicProtectionAffect(Creature angel) {
                _angel = angel;
                Add(new Affects.StrikeRedirect(angel.Owner, angel));
            }

            public override Affect Clone() {
                return new AngelicProtectionAffect(_angel);
            }
        }
    }
}
